package com.yingxin.yxerp.module.common;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class SplitSearchStrHelper {

    public static List<String> split(String splitStr) {
        if (StringUtils.isEmpty(splitStr)) {
            return null;
        }
        splitStr = splitStr.trim();
        splitStr = splitStr.replaceAll(" ", ",");
        splitStr = splitStr.replaceAll("，", ",");
        if (splitStr.contains(",")) {
            List<String> list = new ArrayList<>();
            String[] array = splitStr.split(",");
            for (String i : array) {
                if (i.length() > 0) {
                    list.add(i);
                }
            }
            if (list.size() > 0) {
                return list;
            }
        }
        return null;
    }

}
